package com.neutech.view;

import com.neutech.dao.impl.foodAchieve;
import com.neutech.entity.food;

import java.util.Scanner;

public class foodLogon {

    static Scanner sc = new Scanner(System.in);
    static foodAchieve foodac = new foodAchieve();
    public static void queryFood(){
        foodac.listFood();
    }

    public static void addFood(){
        System.out.println("请输入食品Id");
        int foodId = sc.nextInt();
        System.out.println("请输入食品名称");
        String foodName = sc.next();
        System.out.println("请输入食品描述");
        String foodExplain = sc.next();
        System.out.println("请输入食品价格");
        String foodPrice = sc.next();
        System.out.println("请输入食品所属商家Id");
        String businessId = sc.next();
        food food = new food(foodId,foodName,foodExplain,foodPrice,businessId);

        foodac.addFood(food);
    }

    public static void updateFood(){
        System.out.println("请输入食品Id");
        int foodId = sc.nextInt();
        System.out.println("请输入食品名称");
        String foodName = sc.next();
        System.out.println("请输入食品描述");
        String foodExplain = sc.next();
        System.out.println("请输入食品价格");
        String foodPrice = sc.next();
        System.out.println("请输入食品所属商家Id");
        String businessId = sc.next();
        food food = new food(foodId,foodName,foodExplain,foodPrice,businessId);

        foodac.updatefood(food);
    }

    public static void deleteFood(){
        System.out.println("请输入食品名称");
        String foodName = sc.next();
        foodac.deletefoof(foodName);
        System.out.println("删除成功");
    }
}
